package com.goldcn.common;

import com.google.common.base.Objects;

/**
 * Created by Administrator on 2016/10/18.
 */
public enum ChannelEnum {
    SXP(1,"私享品","1484566294091"),
    TZB(2,"淘猪宝","1"),
    JD(3,"京东","2"),
    TB(4,"淘宝","3"),
    TM(5,"天猫","5"),
    OTHER(20,"其他","20");

    private Integer code;
    private String desc;
    private String secretKey;

    ChannelEnum(Integer code, String desc,String secretKey) {
        this.code = code;
        this.desc = desc;
        this.secretKey = secretKey;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public Integer val(){
        return getCode();
    }

    public static ChannelEnum valuekOf(String secretKey) {
        for (ChannelEnum channelEnum :
                values()) {
            if (Objects.equal(channelEnum.getSecretKey(),secretKey)) {
                return channelEnum;
            }
        }
        return null;
    }
}
